<template>
  <div align="center">
        <el-row>
            <el-col :span="24"><div class="grid-content bg-purple-dark"><h1>预约记录</h1></div></el-col>
            <el-col :span="24"><div class="grid-content bg-purple-dark">
                <el-table
                    height="585px"
                    size="small"
                    current-row-key="id"
                    :data="r_ReportToUploadList"
                    stripe
                    highlight-current-row>
                <el-table-column
                    type="index"
                    align="center"
                    label="序号"
                ></el-table-column>
                <el-table-column
                    prop="hMemberofthefile.hFn"
                    label="档案号"
                    align="center"
                ></el-table-column>
                <el-table-column
                    prop="hMemberofthefile.hName"
                    label="预约人"
                    align="center"
                ></el-table-column>
                <el-table-column
                    prop="orderdate"
                    label="体检时间"
                    align="center"
                ></el-table-column>
                <el-table-column label="操作" align="center">
                    <template slot-scope="scope">
                        <el-button type="primary" size="mini" @click="getList(scope.$index,scope.row)">查看</el-button>
                    </template>
                </el-table-column>
                </el-table>
            </div></el-col>
            <el-col>
                <el-pagination
                    background
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="1"
                    :page-sizes="[5, 10, 20]"
                    :page-size="5"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="ReportTotal"
                >
          </el-pagination>
            </el-col>
        </el-row>
  </div>
</template>

<script>
import { listSelectTOrder,getById } from "@/api/RReporttoupload";

export default {
    data(){
        return{
            ReportTotal: 0,
            r_ReportToUploadList: [],
            search: {
                offset: 1,
                limit: 5,
                name:sessionStorage.getItem('is_loginID')
            },
        }
    },
    methods:{
        handleSizeChange(val) {
            this.search.limit = val;
            this.search.offset = 1;
            this.getReportList();
        },
        handleCurrentChange(val) {
            this.search.offset = val;
            this.search.currentPage = val;
            this.getReportList();
        },
        getReportList() {
            listSelectTOrder(this.search)
            .then((response) => {
                console.log(response.data);
                this.ReportTotal = response.data.total;
                this.r_ReportToUploadList = response.data.rows;
            })
            .catch((error) => {
                console.log(error);
            });
        },
        getList(index, row) {
              sessionStorage.setItem("getID", row.id);
              console.log(sessionStorage.getItem('getID'));
              this.$router.push({
                path: '/family',
              })
        },
        outputError(error) {
            console.log(error.response ? error.response : error.message);
             this.loading = false;
            this.$message({
                showClose: true,
                message: "出错了，请按F12查看浏览器日志。",
                type: "error",
            });
        },
    },
    created(){
        if (window.sessionStorage) {
            const data = sessionStorage.getItem("is_login");
            console.log(data);
            if (data!=null && data!="") {
                console.log(12)
            } else {
                this.$router.push({
                path: '/patientlogin',
                })
                return
            }
        }
        this.getReportList();
    }
}
</script>

<style>

</style>